home *** CD-ROM | disk | FTP | other *** search
- Path: news.NetVision.net.il!news
- From: zivshosh@netvision.net.il ( Ziv)
- Newsgroups: comp.lang.c
- Subject: Re: Help, I think with an array
- Date: Wed, 10 Apr 1996 16:38:05 GMT
- Organization: NetVision LTD.
- Message-ID: <316be255.2788761@news.netvision.net.il>
- References: <4kbhcl$p4l@uwm.edu>
- NNTP-Posting-Host: ts005p16.pop4a.netvision.net.il
- X-Newsreader: Forte Agent .99c/16.141
-
- On 8 Apr 1996 17:11:49 GMT, mardavuy@alpha2.csd.uwm.edu (Mario David
- Uy) wrote:
-
- >I am a beginner to programming and I have a problem.
- >Well, I have this one table that I want to use. I looks somewhat like this.
- >
- >Age points
- >30 -3
- >31 -2
- >32-33 -1
-
- You'll have to write explicitely: 32 -1
- 33 -1
- >34 0
- >35-36 1
-
- 35 1
- 36 1
- >... ...
- >
- >What I want the program to do is have a user input the age value and then the
- >program will give the point value.
- >
- >I have no idea how to do this, but I think I need to use an array
- >(I sure I could use if...else but I want to try to use an array.
- >Also I have seven of these tables)
- >
- >Thanks,
- >David
- >mardavuy@csd.uwm.udu
- >--
- >-------------------------------------------------------------------------------
- >|| ||Is it gonna be hide or seek, ||
- >|| Mario David Uy || is it gonna be win or lose? ||
- >|| mardavuy@csd.uwm.edu ||Is it gonna be pride that keeps||
-
- You also need 2 arrays: one for the age, the other for the points.
- The input age has to be searched against the first array to get the
- index which will then be used to return the points. I can write the
- code but then you won't learn much, will you.
-
- If thats all you need you may be much more comfortable with AWK or
- PERL
- Ziv
-